﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["role"] != null)
        {
            if (Session["role"].Equals("99"))
            {
                //load admin funtions                
            }
        }
        fetch_two_third_left_ct();
        fetch_two_third_left_listView();
        fetch_two_third_rigth();
    }

    private void fetch_two_third_rigth()
    {
        DatabaseProcess dp = new DatabaseProcess();
        String query = "select title,details,news_id,image_ from news ";
        DataTable dt = dp.ConnectDataBaseReturnDT(query);
        twothird_right_ct.dt = dt;
        twothird_right_ct.FetchDataTitle();
        twothird_right_ct2.dt = dt;
        twothird_right_ct2.FetchDataTitle();
        twothird_right_ct3.Dt = dt;
        twothird_right_ct3.FetchData();
    }

    private void fetch_two_third_left_ct() {
        DatabaseProcess dp = new DatabaseProcess();
        String query = "select TOP 5 title,details,news_id,image_ from news ";
        DataTable dt = dp.ConnectDataBaseReturnDT(query);
        news.Dt = dt;
        news.FetchDataList();
        news.FetchDataTitle(); 
    }

    private void fetch_two_third_left_listView() { 
        DatabaseProcess dp = new DatabaseProcess();
        String query = "select title,details,news_id from news ";
        DataTable dt = dp.ConnectDataBaseReturnDT(query);
        news_list.dt = dt;
        news1.dt = dt;
        news2.dt = dt;
        news_list.Fetch_data();
        news1.Fetch_data();
        news2.Fetch_data();
    }
}